package config

import (
	"fmt"
	"github.com/BurntSushi/toml"
)

type Config struct {
	Block struct {
		Difficulty int `toml:"difficulty"`
	} `toml:"block"`
	App struct {
		Debug bool `toml:"debug"`
	} `toml:"app"`
}

func loadConfig(path string) (config Config, err error) {
	_, err = toml.DecodeFile(path, &config)
	return
}

func loadPublic() (config Config) {
	var err error
	config, err = loadConfig("./config/public.toml")
	if err != nil {
		panic(err)
	}
	return
}

func loadDev() (config Config) {
	var err error
	config, err = loadConfig("./config/dev.toml")
	if err != nil {
		fmt.Println("Not found dev.toml, just load public config")
	}
	return
}

var Public = loadPublic()

//var Dev = loadDev()
